home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Demos
/
Bowers Development
/
AppMaker 2.0b5
/
Examples
/
PowerPlant
/
Gadgets
/
CPallette.cp
< prev
next >
Wrap
Text File
|
1996-03-19
|
3KB
|
176 lines
// CPallette.cp -- window methods
// Created 3/19/96 12:49 PM by AppMaker
#include "CPallette.h"
#include <UReanimator.h>
#include <URegistrar.h>
#include <LStream.h>
#include <LStdControl.h>
#include "CGadgetsData.h"
#include "CmdCodes.h"
#define PPob_PalletteID 204
#define RidL_PalletteID 204
Boolean CPallette::sIsRegistered = false;
//----------
void
CPallette::RegisterClass ()
{
URegistrar::RegisterClass ('Pale', (ClassCreatorFunc)CPallette::CreatePalletteStream);
// register the pane classes we use
sIsRegistered = true;
}
//----------
CPallette*
CPallette::CreatePallette(
LCommander *inSuperCommander,
CGadgetsData *inData)
{
if (!sIsRegistered) {
RegisterClass ();
}
CPallette *window;
window = (CPallette *)LWindow::CreateWindow(PPob_PalletteID, inSuperCommander);
window->ConnectToData (inData);
return window;
}
//----------
// This is the function you register with URegistrar to create a
// CPallette from a resource
CPallette*
CPallette::CreatePalletteStream(
LStream *inStream)
{
return (new CPallette(inStream));
}
//----------
CPallette::CPallette()
{
}
//----------
CPallette::CPallette(
LStream *inStream)
: LWindow(inStream)
{
}
//----------
CPallette::~CPallette()
{
}
//----------
// This member function gets called once the containment hierarchy that contains
// this pane has been built. It gives us a chance to get data members for
// interesting subviews, and to do other operations now that our subviews exist.
void
CPallette::FinishCreateSelf()
{
mToolsPalette = (LStdControl *)FindPaneByID ('Toos');
UReanimator::LinkListenerToControls(this, this, RidL_PalletteID);
// the purpose is to "connect" self to whatever controls
// that we want to "listen" to
// any additional initialization for your window:
}
//----------
void
CPallette::ConnectToData (CGadgetsData *inData)
{
mData = inData;
inData->AddListener (this);
}
//----------
void
CPallette::ListenToMessage(
MessageT inMessage,
void *ioParam)
{
switch (inMessage) {
default:
break;
}
}
//----------
Boolean
CPallette::ObeyCommand(
CommandT inCommand,
void *ioParam)
{
Boolean cmdHandled = true;
switch (inCommand) {
// +++ Add cases here for the commands you handle
// Remember to add same cases to FindCommandStatus below
// to enable/disable the commands
default:
cmdHandled = LWindow::ObeyCommand(inCommand, ioParam);
break;
}
return cmdHandled;
}
//----------
void
CPallette::FindCommandStatus(
CommandT inCommand,
Boolean &outEnabled,
Boolean &outUsesMark,
Char16 &outMark,
Str255 outName)
{
outUsesMark = false;
switch (inCommand) {
// +++ Add cases here for the commands you handle
default:
LWindow::FindCommandStatus(inCommand, outEnabled,
outUsesMark, outMark, outName);
break;
}
}
//----------
Boolean
CPallette::FocusDraw()
{
Boolean focused = LView::FocusDraw();
if (focused) {
AuxWinHandle awHndl;
CTabHandle awCTable;
ColorSpec contentSpec;
GetAuxWin(GetMacPort(), &awHndl);
awCTable = (**awHndl).awCTable;
contentSpec = (**awCTable).ctTable [wContentColor]; // should search vs. index
::RGBBackColor(&contentSpec.rgb);
}
return focused;
}